package cn.xfdzx.android.apps.shop.activity;


import android.content.res.ColorStateList;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.adapter.HomeVPAdapter;
import cn.xfdzx.android.apps.shop.base.BaseMvpActivity;
import cn.xfdzx.android.apps.shop.fragment.shop_comments.AllFragment;
import cn.xfdzx.android.apps.shop.fragment.shop_comments.PartFragment;

public class XFDAllCommentsActivity extends BaseMvpActivity {

    @BindView(R.id.tl_all_title)
    TabLayout mTabLayout;
    @BindView(R.id.vp_fragment)
    ViewPager vpFragment;
    private List<Fragment> mFragments;
    private String[] title = {"有内容的评价(503）", "全部评价(1254）"};
    private HomeVPAdapter homeVPAdapter;
    @Override
    public int getLayoutId() {
        return R.layout.activity_xfdall_comments;
    }

    @Override
    public void initView() {
        mFragments = new ArrayList<>();
        mFragments.add(PartFragment.newInstance(1));//
        mFragments.add(AllFragment.newInstance(1));//
        mTabLayout.setTabMode(TabLayout.MODE_FIXED);
        mTabLayout.setTabRippleColor(ColorStateList.valueOf(this.getResources().getColor(R.color.picture_color_transparent)));
        for (String tab : title) {
            mTabLayout.addTab(mTabLayout.newTab().setText(tab));
        }
        homeVPAdapter = new HomeVPAdapter(getSupportFragmentManager(), title, mFragments);
        vpFragment.setAdapter(homeVPAdapter);


        mTabLayout.setupWithViewPager(vpFragment);
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void onError(Throwable throwable) {

    }
}
